""" DigitalICS: mobile data collection tool to complete surveys with integrated multimedia

    Copyright (C) 2009. Yael Schwartzman  

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
    
    Contact information: Yael Schwartzman -  yaelsf@gmail.com
    """
from api.form import Form
from api.constants import Constants


def enform4(community,municipio,localidad,producer,num_parcels = None):
    c = Constants()
    form = Form()        
    form.set_community_id(community)
    form.set_producer_id(producer)
    form.set_municipio_id(municipio)
    form.set_localidad_id(localidad)
    
    form.set_num_parcels(num_parcels)
    
    form.set_id("Section4")
    form.set_module("enform4")
    form.set_name("Organizational Aspects")
    
    form.add_mult_data(["manual_labor","activity","days","pay","manual_labor_children",
                        "activity_children","jorn_children","pay_children","school","assembly_participation",
                        "balance","crop_sales","type_of_sale","knows_the_price","received_quantity","knows_social_premium",
        "social_premium","ts1","ts2"])
    
    form.add_prompt(label = "1. Did the producer hire manual labor? ",
                    audio = "9.1manual_labor",
                    id = "1.hired",
                    data = "manual_labor",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output = {'YES':"1. THE PRODUCER DID HIRE MANUAL LABOR",
                              'NO':"1. THE PRODUCER DID NOT HIRE MANUAL LABOR"})
    
    form.add_prompt(relevance ={'1.hired' : " =='YES'"},
                    label = "2. Which activity was the manual labor used for?",
                    audio = "9.1labor_act",
                    id = "2.activity",
                    data = "activity",
                    input_type = c.SELECT,
                    options =["prunning","cleanings","harvesting","processing"],
                    output = " THE MANUAL LABOR WAS EMPLOYED FOR : #VAR")
    
    
    form.add_prompt(relevance ={'1.hired' : " =='YES'"},                    
                    label = "3. Number of days employed",
                    audio ="9.1days",
                    id = "3.days",
                    data = "days",
                    input_type = c.INPUT,
                    return_type = c.RETURN_INTEGER,
                    output = "NUMBER OF DAYS EMPLOYED: #VAR") 
    
    form.add_prompt(relevance ={'1.hired' : " =='YES'"},                   
                    label ="4.What were the daily manual labor wages?",
                    audio = "9.1pay",
                    id = "4.pay",
                    data = "pay",
                    input_type = c.INPUT,
                    return_type = c.RETURN_FLOAT,
                    output = "THE PRODUCER PAID $#VAR PESOS PER DAY FOR  MANUAL LABOR ")
     
    form.add_prompt(label = "5. Did the producer hire children to work in the coffee farm?",
                    audio = "9.2children",
                    id = "5.hired children",
                    data = "manual_labor_children",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output ={'YES': "2. THE PRODUCER HIRED  CHILDREN TO WORK IN THE COFFEE FARM",
                             'NO': "2. THE PRODUCER DID NOT HIRE  CHILDREN TO WORK IN THE COFFEE FARM"},
                    breach = ['YES'])
    
    form.add_prompt(relevance ={'5.hired children' : " =='YES'"},
                    label = "6. Which activity were the children hired for?",
                    audio = "9.2act_children",
                    id = "6.act. children",
                    data = "activity_children",
                    input_type = c.SELECT,
                    options =["prunning","cleanings","harvesting","processing"],
                    output = " THE CHILDREN WHERE HIRED FOR THE  : #VAR")
    
    
    form.add_prompt(relevance ={'5.hired children' : " =='YES'"},                    
                    label = "7. Number of days worked by children:",
                    audio ="9.1days_children",
                    id = "7.jornal_children",
                    data = "jorn_children",
                    input_type = c.INPUT,
                    return_type = c.RETURN_INTEGER,
                    output = "NUMBER OF DAYS THAT CHILDREN WORKED ON THE COFFEE FARM: #VAR") 
    
    form.add_prompt(relevance ={'5.hired children' : " =='YES'"},                   
                    label ="8. How much were the children paid per day?",
                    audio = "9.2pay_children",
                    id = "8.pay_children",
                    data = "pay_children",
                    input_type = c.INPUT,
                    return_type = c.RETURN_FLOAT,
                    output = "THE PRODUCER PAID CHILDREN $#VAR PESOS PER WORKING DAY")
    
                     
    form.add_prompt(relevance ={'5.hired children' : " =='YES'"},
                    label= "10. Did the  hired children stopped going to school to work in the coffee farm?",
                    audio = "9.2esc_children",
                    id = "10.school",
                    data =  "school",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output = {'YES': "THE HIRED CHILDREN STOPPED GOING TO SCHOOL TO WORK IN THE COFFEE FIELDS",
                              'NO': "THE HIRED CHILDREN DID NOT STOP GOING TO SCHOOL TO WORK IN THE COFFEE FIELDS"})
    
    form.add_prompt(label = "10. Did the producer go to the regional or communitary assemblies?",
                    audio = "9.3assembly",
                    id = "11.assembly",
                    data = "assembly_participation",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output = {'YES':"3. THE PRODUCER WAS PART OF THE REGIONAL AND COMMUNITARY ASSEMBLIES",
                              'NO':"3. THE PRODUCER WAS NOT PART OF THE REGIONAL AND COMMUNITARY ASSEMBLIES"},
                    breach = ['NO'])
    
    form.add_prompt(label = "12. Did the organization's board of directors do a commercialization balance?",
                    audio ="9.4com_balance",
                    data = "balance",
                    id = "12.balance",
                    input_type = c.SELECT1,
                    options = ['YES','NO','NOT YET', 'DOES NOT KNOW'],
                    output =  {'YES':"4.THE ORGANIZATION'S BOARD OF DIRECTORS DID DO A COMMERCIALIZATION BALANCE",
                               'NO':"4.THE ORGANIZATION'S BOARD OF DIRECTORS DID NOT DO A COMMERCIALIZATION BALANCE",
                               'NOT YET':"4.THE ORGANIZATION'S BOARD OF DIRECTORS HAS  NOT YET  DONE A COMMERCIALIZATION BALANCE",
                               'DOES NOT KNOW':"4.THE PRODUCER DOES NOT KNOW IF THE ORGANIZATION'S BOARD OF DIRECTORS HAS  DONE A COMMERCIALIZATION BALANCE"},                                                            
                    breach = ['DOES NOT KNOW'])
    
    form.add_prompt(label = "13.Does the producer know if the board of directors informed the last harvest's final price?",
                    audio = "9.5harvesting",
                    data = "crop_sales",
                    id = "13.crop_sales",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output = {'YES': 'THE PRODUCER KNOWS IF THE BOARD OF DIRECTORS INFORMED HOW THE COFFEE WAS SOLD',
                              'NO': 'THE PRODUCER DOES NOT KNOW IF THE BOARD OF DIRECTORS INFORMED HOW THE COFFEE WAS SOLD'},
                    breach = ['NO'])
    
    
    form.add_prompt(label = "15. Does the producer know what was the final coffee price?",
                    audio = "9.6price",
                    id = "15.knows price",
                    data = "knows_the_price",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output = {'YES':"THE PRODUCER  KNOWS WHAT THE FINAL COFFEE PRICE WAS",
                              'NO':"THE PRODUCER  DOES NOT KNOW  WHAT THE FINAL COFFEE PRICE WAS"},
                    breach = ['NO'])
                    
     
    form.add_prompt(relevance = {'15.knows price': " == 'YES'"},
                    label ="16. Final coffee price",
                    audio = "9.6price_final",
                    id = "16.final price",
                    data = "received_quantity",
                    input_type = c.INPUT,
                    return_type = c.RETURN_FLOAT,
                    output = "FINAL PRICE: $#VAR PESOS")
    
    form.add_prompt(label = "17. Does the producer know how much did his  organization received as a social premium?",
                    audio = "9.7social_en",
                    id = "17.knows social",
                    data = "knows_social_premium",
                    input_type = c.INPUT,
                    return_type = c.RETURN_BOOLEAN,
                    output = {'YES': "7. THE PRODUCER KNOWS HOW MUCH HIS ORGANIZATION RECEIVED AS A SOCIAL PREMIUM",
                              'NO': "7. THE PRODUCER DOES NOT KNOW HOW MUCH HIS ORGANIZATION RECEIVED AS A SOCIAL PREMIUM"},
                    breach = ['NO'])
    
    form.add_prompt( relevance = {'17.knows social' :" =='YES' "},
                     label = "18. Social premium:",
                     audio = "9.7how_much_social",
                     id = "18.how much premium",
                     data = "social_premium",
                     input_type = c.INPUT,
                     return_type = c.RETURN_FLOAT,
                     output= "SOCIAL PREMIUM: $#VAR PREMIUM")
     

    
    return form
